package com.taoyi.mhouse;

import android.test.ActivityInstrumentationTestCase2;
import android.view.View;

import com.taoyi.mhouse.activities.MainActivity;


/**
 * Created by tempo on 2015/11/19.
 *
 * 1新建类继承自TestCase(单元测试)或AndroidTestCase(android相关)或ActivityInstrumentationTestCase2(activity测试)
 * 2配置运行信息,可以设置包,类,应用等
 * 3直接运行会执行测试包下的所有已test开头的方法
 * 4测试方法必须以test开头
 */
public class ActivityTest extends ActivityInstrumentationTestCase2<MainActivity> {
    public ActivityTest() {
        super(MainActivity.class);
    }

    public void testDemo(){
        MainActivity activity=getActivity();
        activity.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                //do something
            }
        });
        activity.finish();
        //set to null
        setActivity(null);
        //get a new activity
        activity=getActivity();

        View v = activity.findViewById(0);
        activity.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                // process view
            }
        });
//        assertEquals();
    }
}
